using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class PagesDAL : SqlDataProvider	{		#region[Pages_GetById]		public List<Pages> Pages_GetById(string Id)		{			List<Data.Pages> list = new List<Data.Pages>();			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_GetById", GetConnection()))			{				Data.Pages obj = new Data.Pages();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PagesIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Pages_GetByTop]		public List<Pages> Pages_GetByTop(string Top, string Where, string Order)		{			List<Data.Pages> list = new List<Data.Pages>();			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_GetByTop", GetConnection()))			{				Data.Pages obj = new Data.Pages();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PagesIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Pages_GetByAll]		public List<Pages> Pages_GetByAll(string Lang)		{			List<Data.Pages> list = new List<Data.Pages>();			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_GetByAll", GetConnection()))			{				Data.Pages obj = new Data.Pages();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PagesIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Pages_Paging]		public List<Pages> Pages_Paging(string CurentPage, string PageSize, string Lang)		{			List<Data.Pages> list = new List<Data.Pages>();			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_Paging", GetConnection()))			{				Data.Pages obj = new Data.Pages();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PagesIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		return list;		}		#endregion		#region[Pages_Insert]		public bool Pages_Insert(Pages data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));				dbCmd.Parameters.Add(new SqlParameter("@Detail", data.Detail));				dbCmd.Parameters.Add(new SqlParameter("@Level", data.Level));				dbCmd.Parameters.Add(new SqlParameter("@Title", data.Title));				dbCmd.Parameters.Add(new SqlParameter("@Description", data.Description));				dbCmd.Parameters.Add(new SqlParameter("@Keyword", data.Keyword));				dbCmd.Parameters.Add(new SqlParameter("@Type", data.Type));				dbCmd.Parameters.Add(new SqlParameter("@Link", data.Link));				dbCmd.Parameters.Add(new SqlParameter("@Target", data.Target));				dbCmd.Parameters.Add(new SqlParameter("@Position", data.Position));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Pages");			return true;		}		#endregion		#region[Pages_Update]		public bool Pages_Update(Pages data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_Update", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));				dbCmd.Parameters.Add(new SqlParameter("@Detail", data.Detail));				dbCmd.Parameters.Add(new SqlParameter("@Level", data.Level));				dbCmd.Parameters.Add(new SqlParameter("@Title", data.Title));				dbCmd.Parameters.Add(new SqlParameter("@Description", data.Description));				dbCmd.Parameters.Add(new SqlParameter("@Keyword", data.Keyword));				dbCmd.Parameters.Add(new SqlParameter("@Type", data.Type));				dbCmd.Parameters.Add(new SqlParameter("@Link", data.Link));				dbCmd.Parameters.Add(new SqlParameter("@Target", data.Target));				dbCmd.Parameters.Add(new SqlParameter("@Position", data.Position));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Pages");			return true;		}		#endregion		#region[Pages_Delete]		public bool Pages_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Pages_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Pages");			return true;		}		#endregion			}}